<template>
	<view>
		 <button v-if="!token" class="mineMask" hover-class="none" @click="getUserInfoAction"  withCredentials="true" ></button>
	</view>
</template>

<script>
import {getToken} from "../../service/auth.js"
	export default {
		data() {
			return {
				token: null
			}
		},
		created() {
			this.token = uni.getStorageSync('token')
		},
		methods:{
			getUserInfoAction(e) {
				this.token = uni.getStorageSync('token')
				if(!this.token){
					wx.getUserProfile({
					    desc:'正在获取',//不写不弹提示框
					    success:res => {
						  res.userInfo.encryptedData = res.encryptedData
						  res.userInfo.iv = res.iv
						  console.log(res)
						  uni.setStorageSync('user', res.userInfo);
						  getToken()
					    }
					  })
				}
			},
	   }	
	}
</script>

<style lang="scss">
	.absolute_rt{
	  position:absolute;
	  right: -10rpx;
	  top: -10rpx;
	  /* margin-left: auto */
	}
	.absoluteItem{
	  position: absolute;
	  top: 580rpx;
	  width: 100%;
	}
	button.mineMask{
	  margin: 0;
	  padding: 0;
	  background-color: transparent;
	  top: 0;
	  width: 100%;
	  height: 100%;
	  z-index: 100000;
	  position: absolute;
	  text-align: center;
	}
	
	button.mineMask:after {
	  content: none;
	}
	 
	button.mineMask::after {
	  border: none;
	}
</style>
